Conventionally, an electronic control device, or, customary called as an electronic control unit (ECU) in the automotive industry, installed in a vehicle for controlling vehicular mechanism such as an engine or the like has a capability for storing a trouble code that is indicative of a trouble of the mechanism based on diagnosis results derived from signals from various sensors. The trouble code, or a so-called diagnostic trouble code (DTC) or a Fault Code, is usually stored in a memory.
The DTC stored in a memory of the ECU is regulated in California by law in the following manner.
The regulation in California is provided by California Air Resources Board (CARB) as ODB2. The regulation includes the following rule. That is,
(a) DTC should be configured to be stored as a permanent fault code (or a Permanent Diagnostic Trouble Code) that is not erased even when a power supply is cut off, and the PDTC should be stored in a period between an occurrence of a trouble and a shut-down of the ECU (stoppage of the operation of the ECU) in association with the turning-off of the ignition key.
To comply with the regulation, the ECU controls the DTC to be stored, as a PDTC, in a rewritable non-volatile memory such as an EEPROM or the like.
Further, the above regulation has the following rules (b) to (e). That is,
(b) PDTC should not be erased by a command that is transmitted from an outside tool that communicates with the ECU.
(c) The number of PDTCs stored in the memory is at least four.
(d) Normal diagnosis in three successive driving cycles may lead to the erasure of the PDTC by the ECU itself. In this case, the driving cycle is a period between a turning-on of an engine and a next turning-on of the engine having a stoppage of the engine interposed therebetween. The driving cycle can be abbreviated as DCY. The normal diagnosis in 3DCYs means that all of the three diagnoses in three successive DCY are normal.
(e) The normal diagnosis after a data clearance in a volatile memory by the removal of a battery from the vehicle may lead to the erasure of the PDTC by the ECU itself.
The data writing in the EEPROM may have the following two concerns. That is, (a) the data writing time in the EEPROM is longer than the other memory such as a RAM or the like, thereby making it difficult to perform the data writing process when the process load of the microcomputer is heavy, and (b) the data writing may be faulty if the voltage of the power supply is not stable. That is, when the power supply is suffering from noise, or when the power supply is suffering from power surge, the data writing may lead to a fault data.
Therefore, the data that should not be lost is written in the EEPROM under the control of the ECU in the following manner. That is, for safe data writing, the ECU is equipped with a power control circuit that controls the operation voltage from the power supply for a microcomputer in the ECU to be maintained until the power shut-down is allowed after completion of the all processes in the microcomputer even when the ignition switch is turned-off. In this manner, after turning-off of the ignition switch, the data in the RAM to be saved is written in the EEPROM. See Japanese patent documents JP-A-H11-141391 and JP3960212. When the ignition switch is turned off, the engine is stopped, thereby making it possible to lighten the processing load of the microcomputer as well as to stabilize the operation voltage of the power supply without suffering from a noise, a surge or the like.
In the ECU, the DTC detected during a wake-up mode of the ECU that is turned on at a certain timing of the ignition switch turned-off period, or during the ignition switch turning-on period can be stored as the PDTC in the EEPROM in the following manner.
That is, when a trouble is detected upon starting the power supply for the ECU, the DTC indicative of the detected trouble is stored in the RAM first, and, after turning-off of the ignition switch, the DTC stored in the RAM is selectively written to the EEPROM by examining whether each of the DTC data fulfills the storage criteria and selecting the criteria-fulfilling DTC data.
Further, the ECU for use in a vehicle is generally configured to perform a process is instructed in a command (a request for performing a process) that is transmitted from an external tool. (See the above patent document JP3960212).
In the above patent document JP3960212, a problem that is inherent in the storage mechanism is described. That is, the problematic situation is, After the latest value of a permanent storage data is retrieved to an external device from a work memory, the latest value of the permanent storage data in the work memory is lost for some reason before a storage of the latest value in the rewritable non-volatile memory, and then a current value in the rewritable non-volatile memory is copied to the work memory upon fulfillment of the data recovery criteria prior to the second retrieval of the permanent storage data in the work memory by the external device. The retrieved data for the second time by the external device may possibly have an older value that is older than the data retrieved for the first time. In view of the above problem, the permanent storage data in the work memory is configured to be stored in the rewritable non-volatile memory even when an output request is received from the external device for outputting the permanent storage data, according to the disclosure in the above patent document.
The ECU that saves, as a PDTC, the DTC to the EEPROM after turning off of the ignition switch if the DTC is detected as a result of the diagnosis during the operation of the ECU due to the power supply may have a problem in case that the ECU receives a command, from the external tool, that leads to the erasure of the OTC in the RAM (i.e., a command that requests the erasure of the DTC). That is, in the above-described case, the DTC detected in the current period of the turning-on of the ignition switch cannot be stored as the PDTC in the EEPROM, due to the fact that the DTC in the RAM is erased at the time of the turning-off of the ignition switch.
For example, the situation may be interpreted as, if a vehicle is brought to a dealership by a user upon recognizing an operation of a warning lamp (MIL) that is caused by the detection of a trouble, the DTC is retrieved from the RAM of the ECU and then erased by the external tool under control of the mechanics in the dealership, the DTC in the RAM cannot be stored as the PDTC in the EEPROM in case that erasure of the DTC is performed without turning-off of the ignition switch of the vehicle.